<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/10/19
 * Time: 10:31
 */
class View {

    public $viewData = array();
    public $viewController;
    public $viewAction;

    public function __construct($controller, $action)
    {
        $this->viewController = $controller;
        $this->viewAction = $action;
    }

//    保存从controller传递过来的要显示的变量
    public function assign($key, $value) {
         $this->viewData[$key] = $value;
    }

//    根据url的controller、action加在相应的页面
    public function fetch() {
       extract($this->viewData);


        include_once "/../application/views/" .  $this->viewController . "/" . $this->viewAction . ".php";
    }
}